package com.qf.team2.netdisc.interceptors;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 编码拦截器
 *
 * @author Simon_Wong
 * @since 2021/5/25 15:32
 */
public class CharsetEncodingInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request
            , HttpServletResponse response, Object handler) throws Exception {
        System.out.println("编码拦截器生效");
        request.setCharacterEncoding("UTF-8");
        return true;
    }
}
